<!--************************************************************ -->
<!--* 文件创建日期：2010                                  * -->
<!--* 文件修改日期：			                                   * -->
<!--************************************************************ -->
<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.service.tech.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    TechSecurityItem item = TechSecurityService.loadTechSecurity(request, response, out);
    int deptId = -1;
    String deptName = "";
    String examinePerson = "";
    String implementPerson = "";
    String participants = "";
    String place = "";
    String planName = "";
    String schematic = "";
    String time = "";
    String timestamp = "";
    String treatDept = "";
    String workSubject = "";
    int xdCommanderId = -1;
    int zdCommanderId = -1;
    String xdCommanderName = "";
    String zdCommanderName = "";
    String actionDetail = "";
    if(item != null) {
    	TechSecurity bean = item.getBean();
    	Department dept = item.getDept();
    	deptName = dept.getPath();
    	Person xdCommander = item.getXdCommander();
    	Person zdCommander = item.getZdCommander();
    	actionDetail = bean.getActionDetail();
    	deptId = bean.getDeptId();
    	examinePerson = bean.getExaminePerson();
    	implementPerson = bean.getImplementPerson();
    	participants = bean.getParticipants();
    	place = bean.getPlace();
    	planName = bean.getPlanName();
    	schematic = bean.getSchematic();
    	time = bean.getTime();
    	timestamp = bean.getTimestamp();
    	treatDept = bean.getTreatDept();
    	workSubject = bean.getWorkSubject();
    	xdCommanderId = bean.getXdCommanderId();
    	zdCommanderId = bean.getZdCommanderId();
    	xdCommanderName = xdCommander.getName();
    	zdCommanderName = zdCommander.getName();
    } 
%>
<html>
<head>
	<title>安全技术工作记录</title>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">	
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	   var legendName="";
	   function init() {
		   if("" != "<%=itemId%>") { // 修改		   	   
		       document.getElementById("legend").style.display = "none";
		       document.getElementById("uploadLink").style.display = "";
		       legendName = "<%=schematic%>";
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	   
	   function validate(){
	   		if(form1.deptId.value == -1){
	   			alert("小队不能为空！");
	   			return true;
	   		}
	   		if(form1.zdCommanderId.value == -1){
	   			alert("中队指挥员不能为空！");
	   			return true;
	   		}
	   		if(form1.xdCommanderId.value == -1){
	   			alert("小队指挥员不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.actionDetail.value.length > 5000){
   				alert("行动基本情况不能超过5000个字！");
   				return true;
	   	    }
	   		return false;
	   }
	   
	    function uploadLegend(){
	   		var url = "security_upload.jsp";
			var width = '400px';
			var height ='200px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;";
			var returnValue = window.showModalDialog(url, "", arg);
			if(returnValue){
				var legend = document.getElementById("legend");
				legendName = returnValue;
				form1.schematic.value = legendName;
				var uploadLink = document.getElementById("uploadLink");
				uploadLink.style.display = "none"
				legend.style.display = "";
			}
	   }
	   
	   function showLegend(pictureDir){
			var url = encodeURI("security_legend.jsp?pictureDir="+pictureDir);
			var width = '700px';
			var height ='500px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;edge=sunken;center=yes;resizable=yes;Minimize=yes;Maximize=yes";
			var returnValue = window.showModalDialog(url, "", arg);
			if(returnValue){
				dataFrame.location.reload();
			}
		}
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="security_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<input type="hidden" name="schematic">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>安全技术工作记录</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="20%">
					<col width="30%">
					<col width="20%">
					<col width="30%">
					<tr>
						<td class="field">
							小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/deptTree.jsp');" treeSelect="true" treeType="1">
								<input name="deptName" nodeId="" id="deptTreeInput" value="<%=deptName %>" 
									style="width: 156px;" readonly="readonly" 
									treeSelect="true"><input name="deptId" value="<%=deptId %>" type="hidden">
							</span>
						</td>
						<td class="field">
							日期
						</td>
						<td>
							<input name="timestamp" value="<%=timestamp %>" type="text" style="width: 150px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							时间
						</td>
						<td>
							<input value="<%=time %>" type="text" style="width: 100%;" name="time">
						</td>
						<td class="field">
							地点
						</td>
						<td>
							<input value="<%=place %>" type="text" style="width: 100%;" name="place">
						</td>
					</tr>
					<tr>
						<td class="field">
							召请单位
						</td>
						<td>
							<input value="<%=treatDept %>" type="text" style="width: 100%;" name="treatDept">
						</td>
						<td class="field">
							工作项目
						</td>
						<td>
							<input value="<%=workSubject %>" type="text" style="width: 100%;" name="workSubject">
						</td>
					</tr>
					<tr>
						<td class="field">
							参与人数及姓名
						</td>
						<td height="100px" colspan="3">
							<textarea name="participants" style="height: 100%;width: 100%"><%=participants %></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							措施审批人
						</td>
						<td>
							<input value="<%=examinePerson %>" type="text" style="width: 100%;" name="examinePerson">
						</td>
						<td class="field">
							贯彻人
						</td>
						<td>
							<input value="<%=implementPerson %>" type="text" style="width: 100%;" name="implementPerson">
						</td>
					</tr>
					<tr>
						<td class="field">
							行动计划名称
						</td>
						<td colspan="3">
							<input value="<%=planName %>" type="text" style="width: 100%;" name="planName">
						</td>
					</tr>
					<tr>
						<td class="field">
							行动基本情况
						</td>
						<td colspan="3" height="100px">
							<textarea style="width: 100%;height: 100%" name="actionDetail"><%=actionDetail %></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							示意图
						</td>
						<td colspan="3" height="120px" valign="middle">
							<a id="uploadLink" href="#" onclick="uploadLegend();">上传图片</a>
							<a id="legend"  href="#" onclick="showLegend(legendName);" style="display:none">查看图片</a>
						</td>
					</tr>
					<tr>
						<td class="field">
							中队指挥员
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="zdCommanderName" nodeId="" id="deptTreeInput" value="<%=zdCommanderName %>" 
									style="width: 156px;" readonly="readonly" 
									treeSelect="true"><input name="zdCommanderId" value="<%=zdCommanderId %>" type="hidden">
							</span>
						</td>
						<td class="field">
							小队指挥员
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="xdCommanderName" nodeId="" id="deptTreeInput" value="<%=xdCommanderName %>" 
									style="width: 156px;" readonly="readonly" 
									treeSelect="true"><input name="xdCommanderId" value="<%=xdCommanderId %>" type="hidden">
							</span>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>